package tr.edu.metu.is.mega.server.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

/**
 * The persistent class for the course database table.
 */
@Entity
public class Course implements Serializable, tr.edu.metu.is.mega.server.core.BaseEntity {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer pkid;

    private String code;

    private String name;

    private String semester;

    // bi-directional many-to-one association to Activity
    @OneToMany(mappedBy = "course")
    private List<Activity> activities;

    // bi-directional many-to-one association to Systemuser
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "fk_instructor", updatable = false)
    private Systemuser instructor;

    // bi-directional many-to-one association to Courseassistant
    @OneToMany(mappedBy = "course", cascade = CascadeType.ALL, orphanRemoval = true)
    private List<Courseassistant> courseassistants;

    // bi-directional many-to-one association to Coursestudent
    @OneToMany(mappedBy = "course", cascade = CascadeType.ALL, orphanRemoval = true)
    private List<Coursestudent> coursestudents;

    // bi-directional many-to-one association to Team
    @OneToMany(mappedBy = "course", cascade = CascadeType.ALL)
    private List<Team> teams;

    /**
     * Default constructor.
     */
    public Course() {
    }

    /**
     * Returns pkid.
     * 
     * @return the pkid
     */
    @Override
    public Integer getPkid() {
        return pkid;
    }

    /**
     * Sets pkid value.
     * 
     * @param pkid the pkid to set
     */
    @Override
    public void setPkid(Integer pkid) {
        this.pkid = pkid;
    }

    /**
     * Returns code.
     * 
     * @return the code
     */
    public String getCode() {
        return code;
    }

    /**
     * Sets code value.
     * 
     * @param code the code to set
     */
    public void setCode(String code) {
        this.code = code;
    }

    /**
     * Returns name.
     * 
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * Sets name value.
     * 
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * Returns semester.
     * 
     * @return the semester
     */
    public String getSemester() {
        return semester;
    }

    /**
     * Sets semester value.
     * 
     * @param semester the semester to set
     */
    public void setSemester(String semester) {
        this.semester = semester;
    }

    /**
     * Returns activities.
     * 
     * @return the activities
     */
    public List<Activity> getActivities() {
        return activities;
    }

    /**
     * Sets activities value.
     * 
     * @param activities the activities to set
     */
    public void setActivities(List<Activity> activities) {
        this.activities = activities;
    }

    /**
     * Returns instructor.
     * 
     * @return the instructor
     */
    public Systemuser getInstructor() {
        return instructor;
    }

    /**
     * Sets instructor value.
     * 
     * @param instructor the instructor to set
     */
    public void setInstructor(Systemuser instructor) {
        this.instructor = instructor;
    }

    /**
     * Returns courseassistants.
     * 
     * @return the courseassistants
     */
    public List<Courseassistant> getCourseassistants() {
        return courseassistants;
    }

    /**
     * Sets courseassistants value.
     * 
     * @param courseassistants the courseassistants to set
     */
    public void setCourseassistants(List<Courseassistant> courseassistants) {
        this.courseassistants = courseassistants;
    }

    /**
     * Returns coursestudents.
     * 
     * @return the coursestudents
     */
    public List<Coursestudent> getCoursestudents() {
        return coursestudents;
    }

    /**
     * Sets coursestudents value.
     * 
     * @param coursestudents the coursestudents to set
     */
    public void setCoursestudents(List<Coursestudent> coursestudents) {
        this.coursestudents = coursestudents;
    }

    /**
     * Returns teams.
     * 
     * @return the teams
     */
    public List<Team> getTeams() {
        return teams;
    }

    /**
     * Sets teams value.
     * 
     * @param teams the teams to set
     */
    public void setTeams(List<Team> teams) {
        this.teams = teams;
    }

}
